<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			function showDiv(){
				var u=document.getElementById("d1");
				//u.parentNode.align="right";
				alert(u.parentNode.innerHTML);
				alert("第一个子元素");
				//alert(u.childNodes.length);
				//元素子节点
				alert("u的nodeValue="+u.nodeValue);
				alert(u.children.length);
				alert(u.firstChild.nodeName+","+u.firstChild.nodeType);
				//u.firstChild.innerHTML="apple";
				u.firstElementChild.innerHTML="apple";
			
				var d=u.parentNode;
				d.previousElementSibling.innerHTML="常见的水果";
				d.nextElementSibling.innerHTML="我是老刘";
			}
		</script>
	</head>
	<body>
		<h2>We change lives</h2>
		<div>
			<ul  id="d1">
				<li>苹果</li>
				<li>桃子</li>
				<li>香蕉</li>
				<li>菠萝</li>
				<li>凤梨</li>
				<li>梨子</li>
				<li>萝卜</li> 
			</ul>
		</div>
		<p>
			大扎好
		</p>
		<input type="button" value="获得元素" onclick="showDiv()">
	</body>
</html>
